#ifndef __AAALGO
#define __AAALGO
#include <iostream>
#include "Graph.h"
#include "IWD.h"
#include <vector>
#include <ctime>
#define INFINIT (-10000)
#define EPSILON (1e-7)

struct solution
{
	std::list<int> nodes;
	double quality;
};

class AAAlgo
{
public:
	Graph *graph;
	solution totalBestSolution;
	int iterMax , iterCount;
	int nIWD;//number of IWD
	static const double roN ;//local soil updating parameter
	static const double roIWD ;//global soil updating parameter
	std::vector<IWD *> IWDs;
	std::vector<int> level0Nodes;

	AAAlgo(int , Graph *);
	void run();
	solution run_one_iteration();
	void spread_randomly();
	void spread_randomly_fl();
	void computeLevel0Nodes();
	void init();
	double computeProbability(int j, IWD *iwd);
	double min(IWD *iwd);
	double f(double pathSoil, double minResult);
	double g(double pathSoil, double minResult);
	double qualityFunction(std::list<int> nodes);
};
#endif